<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>课程公告</title>
  <link rel="stylesheet" href="__PUBLIC__/script/Plug/bootstrap/css/bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/style/Course/common.css">
  <link rel="stylesheet" href="__PUBLIC__/script/Plug/bootstrap/css/bootstrap-theme.min.css">
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/style/Plug/Validation-Engine/validationEngine.jquery.css">
  <script type="text/javascript">var root = "__APP__";</script>
  <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  <script src="__PUBLIC__/script/Common/jquery-1.10.2.js"></script>
 
  <script type="text/javascript" src="__PUBLIC__/script/Plug/Validation-Engine/jquery.validationEngine.js"></script>
  <script type="text/javascript" src="__PUBLIC__/script/Plug/Validation-Engine/jquery.validationEngine-zh_CN.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
  <script src="__PUBLIC__/script/Plug/bootstrap/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="__PUBLIC__/script/Plug/artDialog/dist/sea.js"></script>
  <script type="text/javascript" src="__PUBLIC__/script/Plug/artDialog/dist/dialog-min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/script/Course/common.js"></script>
</head>
<body>

  <include file="Course:s_head" active="notice-li"/>
    
    <div class="main">
    
    <div class="pub-area">
     
    </div>

     <table class="tableList table table-striped table-bordered table-hover">
        <tr>
          <th>标题</th>
          <th>发布时间</th>
          <th>发布人</th>
        </tr>
        <volist name="noticeList" id="no">
            <tr>
                <td><a href="__CONTROLLER__/s_ShowNoticeInfo/courseId/{$Think.get.courseId}/noticeId/{$no.id}">{$no.title}</a></td>
                <td>{$no.pub_time|date="Y-m-d",###}</td>
                <td>{$no.teacher_name}</td>
            </tr>
            <tr>
              {$page}
            </tr>
        </volist>
    </table>   
    </div>
    <div class="modal fade " id="notice-modal" tabindex="-1" role="dialog"  aria-hidden="true">
      <div class="modal-dialog" style="width:350px;">
        <div class="modal-content" style="height:300px;">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="mySmallModalLabel">发布公告</h4>
          </div>
          <div class="modal-body" style="  text-align: center;line-height: 60px;height: 100px;">
            <form id="notice-form">
          
              <div class="input-group">
              <input type="text" class="form-control validate[required]" placeholder="标题" aria-describedby="basic-addon1" style="width:300px;" name="title" id="notice-title">
              </div>
              <p></p>
              <div class="input-group">
                <input type="text" class="form-control validate[required]" placeholder="内容" aria-describedby="basic-addon1" style="height:90px;width:300px;" name="content" id="notice-content">
              </div>
              <p>
              <input class="btn btn-success" id="notice-button" type="submit" value="提交" courseId="{$Think.get.courseId}">
          </p>
          </form>
        </div>
      </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
  </div><!-- /.modal -->

    <div class="modal fade bs-example-modal-sm" id="message-modal" tabindex="-1" role="dialog"  aria-hidden="true">
      <div class="modal-dialog modal-sm">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="mySmallModalLabel">提示</h4>
          </div>
          <div class="modal-body" style="  text-align: center;line-height: 60px;height: 100px;">
          </div>
        </div><!-- /.modal-content -->
      </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
  <script type="text/javascript">
  $(function(){
      $('#pub-notice-btn').click(function(){
        $('#notice-modal').modal(true);
      });
    


   $('#notice-form').validationEngine({
    'custom_error_messages':{
      '#notice-title' : {
        'required':{
          'message' : '* 请输入公告标题'
        }
      },
      '#notice-content': {
        'required' : {
          'message': '* 请输入公告内容'
        }
      }
    },
    'onValidationComplete' : function(form,status){
      if (status === true) {
          var title    = $('#notice-title').val();
          var content  = $('#notice-content').val();
          var course_id = $('#notice-button').attr('courseId'); 
          var __hash__ = $('input[name=__hash__]').val();

          $.post('__CONTROLLER__/t_PubNotice',
            {
              title     :  title,
              content   :  content,
              course_id  :  course_id,
              __hash__      :  __hash__
            },function(data,status){
               $('#notice-modal').modal('hide');
               if (data.status == 0 ) {
                  $('#message-modal .modal-body').text(data.message);
                  $('#message-modal').modal(true);
                }else{
                   $('#message-modal .modal-body').text(data.message);
                   $('#message-modal').modal(true);
                     setTimeout(function(){
                  $('#message-modal').modal('hide');
                  location.reload(true);
                },1500)
               }
          })  
        }
    },
    // 'ajaxFormValidation' : true,
    'ajaxFormValidationMethod' : 'post'
  })
  })
  </script>
    <!-- <include file="Public:footer" /> -->

</body>
</html>